<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>课程列表</title>
</head>
<body>
<div style="text-align:right">欢迎您，${currentUser.name} | <a href="logout">退出</a> </div>
<h2>可选课程</h2>
<table>
	<tr>
		<td>编号</td>
		<td>课程名</td>
		<td>授课老师</td>
		<td>学分</td>
		<td>操作</td>
	</tr>
	<c:forEach items="${availableCourseList}" var="course">
		<tr>
			<td>${course.id}</td>
			<td>${course.name}</td>
			<td>
				<c:forEach items="${course.teachers }" var="teacher">
					${teacher.name }&nbsp;
				</c:forEach>
			</td>
			<td>${course.score}</td>
			<td><a href="select?courseId=${course.id}">选择</a></td>
		</tr>
	</c:forEach>
</table>

<hr/>

<h2>已选择课程</h2>
<table>
	<tr>
		<td>编号</td>
		<td>课程名</td>
		<td>授课老师</td>
		<td>学分</td>
		<td>操作</td>
	</tr>
	<c:forEach items="${selectedCourseList}" var="course">
		<tr>
			<td>${course.id}</td>
			<td>${course.name}</td>
			<td>
				<c:forEach items="${course.teachers }" var="teacher">
					${teacher.name }&nbsp;
				</c:forEach>
			</td>
			<td>${course.score}</td>
			<td>
				<a href="unselect?courseId=${course.id}">取消选择</a> 
			</td>
		</tr>
	</c:forEach>
</table>

</body>
</html>